package com.example.demo.controller.UserControl;

import com.example.demo.Exception.BackErrorException;
import com.example.demo.entity.BackResponseEntity;
import com.example.demo.entity.requestJson.UregisterReq;
import com.example.demo.service.URegistService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/userRegist")
@Api(value = "用户注册接口", tags = "用户注册接口")
public class URegistController {
    @Autowired
    private URegistService uRegistService;

    @ApiOperation(value = "用户注册", notes = "loginRole,注册角色（0：作者；1：读者）")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )
    @PostMapping("/Regist")

    public BackResponseEntity<Object> Regist(@RequestBody UregisterReq uregisterReq) throws BackErrorException {
       return uRegistService.userRegist(uregisterReq);
    }
}
